package com.gzx.bi.modular.attend.controller;

import com.gzx.bi.modular.attend.bo.GzxProjectAttendanceEditVo;
import com.gzx.bi.modular.attend.service.GzxProjectAttendanceService;
import com.gzx.bi.modular.attend.vo.GzxProjectAttendanceVo;
import lombok.RequiredArgsConstructor;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;
import vip.xiaonuo.common.pojo.CommonResult;

import java.util.List;

/**
 * 出勤信息
 */
@RestController
@RequiredArgsConstructor
@RequestMapping("/bi/attendance")
public class GzxProjectAttendanceController {

    private final GzxProjectAttendanceService attendanceService;

    /**
     * 获取每天的出勤信息
     */
    @PostMapping("/listCurrentAttendance")
    public CommonResult<List<GzxProjectAttendanceVo>> listCurrentAttendance() {
        return CommonResult.data(attendanceService.listCurrentAttendance());
    }

    /**
     * 修改某个项目的出勤人数
     */
    @PostMapping("/edit")
    public CommonResult<Void> edit(@RequestBody GzxProjectAttendanceEditVo param) {
        attendanceService.edit(param);
        return CommonResult.ok();
    }
}
